#include <linux/uaccess.h>
#include <linux/fs.h>
#include <linux/stat.h>
#include <linux/i2c.h>
#include <linux/cdev.h>
#include <linux/init.h>
#include <linux/kernel.h>
#include <linux/module.h>
#include <linux/kmod.h>

/*
compare
tree  /sys/bus/i2c/devices/
output
before and after use this  module

http://t.csdn.cn/LsSzL

Each I2C device which has been created using i2c_new_device() or
i2c_new_probed_device() can be unregistered by calling
i2c_unregister_device().  If you don't call it explicitly, it will be
called automatically before the underlying I2C bus itself is removed, as a
device can't survive its parent in the device driver model.


 */
struct i2c_client* client;

struct  __initdata i2c_board_info info = {
		I2C_BOARD_INFO("myi2c-dev100", 0x73),
		};

static __init int my_init(void) {
	struct i2c_adapter* adap = i2c_get_adapter(9);
	client = i2c_new_device(adap,&info);
	pr_info("a3 init_module  request_module\n");
	return 0;
}

static void __exit my_exit(void) {
	pr_info("a3 cleanup_module\n");
	i2c_unregister_device(client);
}

module_init(my_init);
module_exit(my_exit);

MODULE_LICENSE("GPL");
MODULE_AUTHOR("Andy");
MODULE_DESCRIPTION("A sample c  driver");
